package com.kele.test.rabbitmq.service;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
@RabbitListener(queues = {"Q1"},concurrency = "1")
public class MQService_High5_Q1 {

    @RabbitHandler()
    public void testRevMsg(String msg, Message message, Channel channel) throws IOException {

        System.out.println("Q1++++++" + msg);
        System.out.println("执行完业务逻辑");
        long deliveryTag = message.getMessageProperties().getDeliveryTag();
        System.out.println(deliveryTag);

        channel.basicAck(deliveryTag,false);//ACK
    }
}
